// import React from 'react'
import './index.scss'
export default function GoodsItem (props) {
    // console.log(props)

    const { goods_count, goods_img, goods_name, goods_price, goods_state, id } = props





    const handlerChange = (e, id) => {

        console.log(e.target.checked)
        console.log(id)
        props.fn(e.target.checked, id)
    }

    return (
        <div className="my-goods-item">
            <div className="left">
                <div className="custom-control custom-checkbox">
                    <input type="checkbox" className="custom-control-input" id={id}

                        checked={goods_state}

                        onChange={(e) => handlerChange(e, id)}

                    />
                    {/* {id} */}
                    <label className="custom-control-label" htmlFor={id}>
                        <img
                            src={goods_img}
                            alt=""
                        />
                    </label>
                </div>
            </div>
            <div className="right">
                <div className="top line-clamp2">  {goods_name}</div>
                <div className="bottom">
                    <span className="price">¥{goods_price}</span>
                    <span>counter组件</span>
                </div>
            </div>
        </div>
    )
}
